<?php
require "../includes/db.php"; 
$mysqli = new MossCMS();
if ($_SESSION[$prefix.'_username'] == ""){  header("Location: ../login.php"); exit;}
if ($_SESSION[$prefix."_security"] < 1){header("location:../login.php?action=5"); exit;}





?>

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="../includes/admin.css"/>
<title><?php echo $global_title;?></title>

<SCRIPT language="JavaScript">
function assure(id)
{
 var where_to= confirm("Do you really want to delete this news article? There is now way to undo this.");
 if (where_to== true)
 {
   window.location="?action=remove&id="+id;
 }
 }
</SCRIPT>

</head>
<body>

<div id="wrap">
	<div id="page-header">
		<?php include('includes/header.php');?>

	</div>
	
	<div id="page-body">
		<div id="tabs">
			<?php $tab="main"; include('includes/header_tabs.php');?>
		</div>

		<div id="acp">
		<div class="panel">
			<span class="corners-top"><span></span></span>
				<div id="content">
				<div id="menu">
						
					<?php include('includes/menu_top.php');?>	
					<?php include('includes/menu_main.php');?>
					</div>
	
					<div id="main">
<a name="maincontent"></a>


	<h1>Manage Users</h1>
	<a href="user_add.php">Add a User</a>

<?php if($tank != ''){
	echo "<div class='successbox'>";
			if($tank == 'ath_activated'){echo "<p class='action_message'>Athlete Activated!</p>";}
			if($tank == 'ath_deactivated'){echo "<p class='action_message'>Athlete Deactivated!</p>";}
	echo "</div>";		
		} ?>
		
				      
       <table class="underline">
          <thead>
          <tr>
          	<th>Username</th>
            <th>User Fullname</th>
			<th>User Level</th>
			<th>Actions</th>

          </tr>
          </thead>
          <tbody>
          <?php
			$results = $mysqli->get_user_list();
      			for($x=0; $x < sizeof($results); $x++) {
				if($class == 'row2'){$class = 'row1';}else{$class = 'row2';}
					
		$edit_title = "<a href ='user_edit.php?id=".$results[$x]['username']."'>".$results[$x]['username']."</a>";
		$delete_link = "<a href =\"javascript:;\" onclick=\"assure(". $results[$x]['username'].");\">$icon_delete</a>";
		echo "<tr class='$class'><td>".$edit_title."</td><td>".$results[$x]['user_fullname']."</td><td>".$results[$x]['user_level_name']."</td><td>".$edit_link.$delete_link."</td></tr>";
			}
			?>
			            
    	</tbody>
        </table>

    
		</div><!-- main -->
	</div><!-- content -->
<span class="corners-bottom"><span></span></span>
</div><!-- panel -->
</div><!-- acp -->

	
	<div id="page-footer">
	<?php include('includes/footer.php');?>
				</div>
</div><!-- page-body -->
</div><!-- wrap -->


</body> 
</html>